#include <stdio.h>

//前两个数之和等于第三个数

int Fib1(int n) { //效率太低，做了大量重复的运算
    if (n > 2) {
        return Fib1(n - 1) + Fib1(n - 2);
    } else {
        return 1;
    }
}

int Fib2(int n) {
    int num1 = 1;
    int num2 = 1;
    int sum = 1;
    while (2 < n) {
        sum = num2 + num1;
        num1 = num2;
        num2 = sum;
        n--;
    }
    return sum;
}

int main() {
    int num;
    printf("请输入数据:>");
    scanf("%d", &num);
    int ret = Fib2(num);
    printf("%d", ret);
    return 0;
}